#ifndef POLLER_H
#define POLLER_H

#include <QObject>
#include <QtNetwork>

class Poller : public QObject
{
    Q_OBJECT
public:
    explicit Poller(QTcpSocket* serverConnection, int port, QString hostname);
    
private slots:
    /**
     * @brief pollServer Polls server repeatedly in order to connect to him.
     */
    void pollServer();

private:

    /**
     * @brief hostname Host name of server to poll.
     */
    QString hostname;

    /**
     * @brief port Port of server to poll.
     */
    int port;

    /**
     * @brief serverConnection Socket in not connected state until polling succeeds.
     */
    QTcpSocket* serverConnection;
};

#endif // POLLER_H
